Ext.define('HIT.view.DealAbandonGrid', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.dealabandongrid',
    
    height: 250,
    width: 400,
    store: 'DealAbandonList',
    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            columns: [
				{
				    xtype: 'rownumberer',
				    resizable: true,
				    width: 30
				},
                {
                    xtype: 'gridcolumn',
                    width: 140,
                    align: 'center',
                    renderer : renderColor,
                    dataIndex: 'DOCUMENT_NO',
                    text: Share.T('单据号'),
                    listeners : {
                    	dblclick : function(e) {
                    		var grid = Ext.getCmp('tab-deal-abandon');
                    		var selModel = grid.getSelectionModel();
                    		var model = selModel.getSelection()[grid.selModel.getCount()-1];
                    		var num = model.get('DOCUMENT_NO');
                    		var node =
    				        {    
    				            "data": { "id": "deal-enter", "text": Share.T('票据录入'), "iconCls": "tj-tree-file"}
    				        };                     //对象形式
                    		Share.documentNo=num;
                    		Share.enterFlag = false;
    						Share.opentTabByPanel(node, 'widget.dealenterpanel',1,false);
    					}
    				}
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'center',
                    dataIndex: 'STATUS',
                    text: Share.T('审核状态')
                },
                {
                    xtype: 'gridcolumn',
                    width: 150,
                    align: 'left',
                    dataIndex: 'CUST_NAME_CHN',
                    style:'text-align:center;',
                    text: Share.T('客户名称')
                },
                {
                    xtype: 'gridcolumn',
                    renderer: Ext.util.Format.numberRenderer('000,000,000.00'),
                    width: 100,
                    align: 'right',
                    dataIndex: 'AMOUNT_CUR_TOTAL',
                    style:'text-align:center;',
                    text: Share.T('原发票价税合计')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'center',
                    dataIndex: 'DOC_TYPE_CODE',
                    text: Share.T('原发票类型')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'center',
                    dataIndex: 'INVOICE_CODE',
                    text: Share.T('原发票代码')
                },
                {
                    xtype: 'gridcolumn',
                    width: 150,
                    align: 'center',
                    dataIndex: 'INVOICE_NO_BEGIN',
                    text: Share.T('原发票开始号')
                },
                {
                    xtype: 'gridcolumn',
                    width: 150,
                    align: 'center',
                    dataIndex: 'INVOICE_NO_END',
                    text: Share.T('原发票结束号')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'center',
                    format : 'Y-m-d',
                    dataIndex: 'INVOICE_DATE',
                    text: Share.T('原开票日期')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'center',
                    format : 'Y-m-d',
                    dataIndex: 'RETURN_DATE',
                    text: Share.T('退回日期')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'center',
                    dataIndex: 'VOID_FLAG',
                    text: Share.T('标记状态')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'center',
                    dataIndex: 'R_INVOICE_CODE',
                    text: Share.T('红票代码')
                },
                {
                    xtype: 'gridcolumn',
                    width: 150,
                    align: 'center',
                    dataIndex: 'R_INVOICE_NO',
                    text: Share.T('红票号码')
                },
                {
                    xtype: 'gridcolumn',
                    width: 150,
                    align: 'center',
                    dataIndex: 'R_INVOICE_NOTICE',
                    text: Share.T('红字通知单号码')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'center',
                    format : 'Y-m-d',
                    dataIndex: 'R_INVOICE_DATE',
                    text: Share.T('红票日期')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'right',
                    style:'text-align:center;',
                    dataIndex: 'R_INVOICE_AMOUNT',
                    text: Share.T('红票金额')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'right',
                    style:'text-align:center;',
                    dataIndex: 'USER_NAME',
                    text: Share.T('申请者')
                },
                {
                    xtype: 'gridcolumn',
                    width: 100,
                    align: 'right',
                    style:'text-align:center;',
                    dataIndex: 'COMPANY_NAME',
                    text: Share.T('公司名称')
                },
                {
                    xtype: 'gridcolumn',
                    width: 200,
                    align: 'left',
                    style:'text-align:center;',
                    dataIndex: 'REMARK',
                    text: Share.T('备注')
                }
            ],
            viewConfig: {

            },
	        selModel: Ext.create('Ext.selection.CheckboxModel', {
	        	checkOnly: false
	        }),
//	        plugins :[{ptype:"rowselectionpaging"}],
            dockedItems: [
          				
                          {
                              xtype: 'pagingtoolbar',
                              id:'DealAbandonListtoolbar',
                              dock: 'bottom',
                              inputItemWidth:45,
                              width: 360,
                              displayInfo: true,
                              store: 'DealAbandonList',
                              plugins: [{
                                  ptype: "pagesize",
                                  uxPageSize: page_size}]
                          }
                      ]
        });
        function renderColor(value, cellmeta, record, rowIndex, columnIndex, store) { 
        	return "<span style='color:blue;cursor:pointer;'>" + value + "</span>";
        } 
        me.callParent(arguments);
    }

});